package com.lej.dataservice.club.umeng

import com.lej.core.base.BaseApplication
import com.lej.core.base.app
import com.lej.core.common.PCacheInfo
import com.lej.core.utils.extention.formatTime
import com.lej.core.utils.extention.versionCode
import com.umeng.analytics.MobclickAgent

enum class PMobclick() {
    ///status 0 拒絕權限
    auth_location,
    btnARClick,
    sendMessage, ///发送聊天消息
    clickMessageEdit,  ///点击消息框
    setting, ///设置
    quitAccount,
    feedback,

    /**[status] 0 登录相关错误*/
    data_error,
    http_error,
    ;

    /** [status]状态  [scope] 作用域,比如登录,群聊,私聊  */
    fun mobEvent(scope: String? = null, status: Int? = null, desc: String? = null) {
       val map= hashMapOf<String, String?>().apply {
            put("sessionId", BaseApplication.sessionId)
            put("uid", PCacheInfo.userId.toString())
            put("time", System.currentTimeMillis().formatTime("yy-MM-dd HH:mm:ss:SSS"))
            scope?.let { put("scope", it) }
            desc?.let { put("desc", it) }
            status?.let { put("status", it.toString()) }
        }
        MobclickAgent.onEvent(app,name,map)
    }
    fun mobEventFirstReport(){
        hashMapOf<String, String?>().apply {
            put("sessionId", BaseApplication.sessionId)
            put("cid", PCacheInfo.userId.toString())
            put("device", System.currentTimeMillis().formatTime("yy-MM-dd HH:mm:ss:SSS"))
            put("sysVer", android.os.Build.VERSION.RELEASE)
            put("ver", app.versionCode.toString())
        }
    }
}